﻿using Com.JunCaiSoft.Common.Enums;
using Com.JunCaiSoft.Common.Struct;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Com.JunCaiSoft.Common.IDao
{
    public interface IQueryWithPageDao<T> where T : class, new()
    {
        List<T> ListByPage<TKey>(Expression<Func<T, TKey>> orderBy, int pageIndex, int pageSize, out long totalRecords, OrderbyType orderType = OrderbyType.ase);
        List<T> ListByPage<TKey>(Expression<Func<T, bool>> where, Expression<Func<T, TKey>> orderBy, int pageIndex, int pageSize, out long totalRecords, OrderbyType orderType = OrderbyType.ase);
        List<T> ListByPage(Expression<Func<T, bool>> condition, int pageIndex, int pageSize, out long total, params OrderModelField[] orderByExpression);

        List<TEntity> ListByPage<TEntity,TKey>(Expression<Func<TEntity, TKey>> orderBy, int pageIndex, int pageSize, out long totalRecords, OrderbyType orderType = OrderbyType.ase) where TEntity : class, new();
        List<TEntity> ListByPage<TEntity, TKey>(Expression<Func<TEntity, bool>> where, Expression<Func<TEntity, TKey>> orderBy, int pageIndex, int pageSize, out long totalRecords, OrderbyType orderType = OrderbyType.ase) where TEntity : class, new();
        List<TEntity> ListByPage<TEntity>(Expression<Func<TEntity, bool>> condition, int pageIndex, int pageSize, out long total, params OrderModelField[] orderByExpression) where TEntity : class, new();

        IQueryable<TEntity> QuerySQLByPage<TEntity>(int pageIndex, int pageSize, out long totalRecords, string sql, params object[] parameters) where TEntity : class, new();
        IQueryable<TEntity> QuerySQLByPageQuick<TEntity>(int pageIndex, int pageSize, out long totalRecords, string orderBy, string colums = null, string tables = null, string where = null, params object[] parameters) where TEntity : class, new();
    }
}
